The present invention relates to a method of controlling frame timing of a mobile communication device. More specifically, the present invention discloses a method for managing a mobile communication device to enter a sleep mode and for recovering frame timing of the mobile communication device after the sleep mode is terminated through an interrupt service routine having the highest priority.
A wireless communication system includes a plurality of base stations. Each base station corresponds to a cell, and is used to control signal reception and signal transmission of a plurality of mobile units located at the cell. The mobile units mostly are portable communication devices or mobile communication devices. For instance, within a global system for mobile communications (GSM), the above-mentioned mobile units are cellular phones.
In order to allow the cellular phones to be conveniently carried, the cellular phones currently adopt rechargeable batteries to provide required operating voltages. Obviously the capacity of the rechargeable battery is limited. If a rechargeable battery with great power capacity is used by a cellular phone to increase overall operational time of the cellular phone, the rechargeable battery substantially increases the size and weight of the cellular phone so that it is not convenient to carry the bulky cellular phone. Therefore, how to decrease the power consumption of the cellular phone has become an important issue. When the power consumption of the cellular phone is reduced, the cellular phone is capable of using a rechargeable battery with a smaller power capacity, a smaller size, and a reduced weight to achieve the same operational time. In other words, the cellular phone becomes more convenient for the user to operate it.
In order to reduce power consumption of the cellular phone, it is well-known that the cellular phone performs a sleep mode to reduce power consumption. For example, when the cellular phone does not receive signals or transmit signals, and the user does not operate the cellular phone, the cellular phone enters an idle mode. The cellular phone, therefore, does not need a clock signal to perform certain operations, and then the cellular phone enters the sleep mode to stop the clock signal from driving components in the cellular phone. In other words, unnecessary power dissipated during the idle mode is cut. The cellular phone then achieves an objective of saving power.
However, it is well-known that the GSM utilizes a related art time division multiple access (TDMA) scheme to perform signal transmission. Timing of the mobile unit needs to be synchronized with frame timing of a corresponding base station so that the mobile unit is capable of receiving signals and transmitting signals. The related art wireless communication system transmits a paging signal to the mobile unit to inform the mobile unit of an incoming call. Therefore, the timing of the mobile unit has to be synchronized with the timing of the base station to correctly receive the paging signal. Even though the mobile unit has entered the sleep mode for saving power, the mobile unit should periodically recover from the sleep mode to detect if the wireless communication system is transmitting the paging signal. In other words, when the mobile unit escapes from the sleep mode, the mobile unit needs to recover its timing to be synchronized with timing of the related art wireless communication system.
Please refer to FIG. 1, which is a block diagram of a related art mobile unit 40. The mobile unit 40 has an antenna 42, a transceiver 44, a timing generator 46, a micro-controller 48, a clock generator 50, and a memory 52. The antenna 42 is capable of receiving radio frequency (RF) signals outputted from a base station 41, and is capable of transmitting RF signals outputted from the mobile unit 40 toward the base station 41. The transceiver 44 is capable of converting RF signals outputted from the antenna 42 into corresponding low-frequency baseband signals, and then delivers the baseband signals to the micro-controller 48. In addition, the transceiver 44 is also capable of converting baseband signals into corresponding high-frequency RF signals, and then outputs the RF signals from the antenna 42.
The micro-controller 48 executes a real-time operating system (RTOS) 54 stored in the memory 52 for controlling overall operation of the mobile unit 40. That is, the micro-controller 48 processes control signals and information signals generated from the base station 41, where the control signals are used to set the required communication protocol used by the mobile unit 40 and the base station 41. The information signals are speech signals or data signals transmitted between a caller and a listener. The clock generator 50 is used to generate a system clock CLK for driving the micro-controller 48 to control the mobile unit 40. In addition, the timing generator 46 generates timing signals according to the system clock CLK, and the timing signals are used to control timing of the mobile unit 40 to be synchronized with the timing of the base station 41 so that the transceiver 44 can transmit and receive signals successfully.
Please refer to FIG. 2, which is a flow chart illustrating operation of the sleep mode run by the mobile unit 40 shown in FIG. 1. The sleep mode run by the mobile unit 40 has the following steps.
Step 100: Start.
Step 102: Perform a sleep manager 56.
Step 104: Check if the mobile unit 40 enters an idle mode through the sleep manager 56. If the mobile unit 40 enters the idle mode, go to step 106; otherwise, go to step 120.
Step 106: Calculate a predetermined running period of the sleep mode for the mobile unit 40 through the sleep manager 56.
Step 108: The mobile unit 40 enters the sleep mode.
Step 110: Run a timing control task 58 before the system clock of the mobile unit 40 is interrupted from driving the micro-controller 48.
Step 112: Use the timing control task 58 to detect if the mobile unit 40 is triggered by an external event to abort the sleep mode (please note that the “external event” means the event occurs outside the micro-controller 48, but not necessarily outside the mobile unit 40). If the external event occurs, go to step 118; otherwise, go to step 114.
Step 114: Calculate an actual running period of the sleep mode performed by the mobile unit 40 through the timing control task 58.
Step 116: Use the timing control task 58 to control the timing generator 46 for recovering timing of the mobile unit 40 to make timing of the mobile unit 40 synchronized with timing of the base station 41.
Step 118: Terminate the timing control task 58.
Step 120: Terminate the sleep manager 56.
Step 122: Finish.
As mentioned above, the micro-controller 48 executes the RTOS 54 to control operation of the mobile unit 40. When the micro-controller 48 runs a sleep manager 56, the sleep manager 56 is activated to drive the mobile unit 40 to enter the sleep mode with the system clock CLK stopped from driving the micro-controller 48, then the operation of the mobile unit 40 is interrupted. According to the related art, the sleep manager 56 is a task with a lowest priority. Therefore, when the sleep manager 56 is successfully executed by the micro-controller 48 (step 102), it means that other tasks with greater priorities have entered the same idle mode. In other words, the mobile unit 40 enters the idle mode now (step 104). Then, the sleep manager 56 starts calculating a predetermined running period of the sleep mode performed by the mobile unit 40 according to information provided by the RTOS 54 (step 106). Next, the sleep manager 56 begins controlling the clock generator 50 to stop the system clock CLK from driving the mobile unit 40 (step 108). However, before the system clock CLK of the mobile unit 40 is actually cut from driving the micro-controller 48, the micro-controller 48 runs a timing control task 58 (step 110) that is an interrupt service routine (ISR). The timing control task 58 detects if the mobile unit 40 is trigged by an external event to abort the sleep mode. If an external event (one key pressed by a user for example) is detected by the mobile unit 40, the sleep mode is aborted before the system clock CLK stops driving the micro-controller 56 (step 120). On the other hand, if an external event is not detected before the system clock CLK stops driving the micro-controller 48, the timing control task 58 will calculate an actual running period of the sleep mode performed by the mobile unit 40. Because the external event might be triggered during the time that the mobile unit 40 is running the sleep mode and the sleep mode then will be terminated immediately to enable the system clock CLK to continue driving the micro-controller 48 for executing an associated ISR, the actual running period of the sleep mode might be less or equal to the predetermined running period. In the end, when the system clock CLK drives the micro-controller 48 again, the timing control task 58 controls a timing signal, which is outputted from the timing generator 46 and inputted into the transceiver 44, for recovering the timing of the mobile unit 40 to be synchronized with the timing of the base station 41 according to the actual running period (step 116). Then, the timing control task 58 (step 118) and the sleep manager 56 (step 120) are sequentially terminated to complete overall timing recovery operation corresponding to the sleep mode.
As mentioned above, the sleep manager 56 is a task having a lowest priority to check if the mobile unit 40 corresponds to an idle mode. However, when step 106 is executed to calculate the predetermined running period of the sleep mode, the sleep manager 56 currently running step 106 is interrupted if an ISR corresponding to a higher priority is triggered. If the sleep manager 56 constantly interrupted by other ISRs having higher priorities, the sleep manager 56 requires a long period of time to complete step 106 for obtaining the predetermined running period. In addition, from the flow chart shown in FIG. 2, the related art needs the sleep manager 56 and the timing control task 58 to respectively activate the sleep mode and the timing recovery operation after the sleep mode is terminated. It is obvious that many interrupt events and exception events should be considered during programming the sleep manager 56 and the timing control task 58. In addition, the sleep manager 56 and the timing control task 58 belong to different processes, operation of the sleep mode and the timing recovery become more complicated as compared with a single process for controlling the operation of sleep mode and performing timing recovery after the sleep mode is terminated.